package ${package.Entity};

<#list table.importPackages as importPackage>
import ${importPackage};
</#list>
import com.baomidou.mybatisplus.annotation.FieldStrategy;
<#if entityLombokModel>
import lombok.Data;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
</#if>
/**
 * ${table.comment}
 * @author: ${author}
 * @since:  ${date}
 */
<#if entityLombokModel>
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
</#if>
@TableName("${table.name}")
public class ${table.entityName} implements Serializable {
<#if entitySerialVersionUID>
    private static final long serialVersionUID = 1L;
</#if>
<#-- ----------  BEGIN 字段循环遍历  ---------->
<#list table.fields as field>
<#if field.keyFlag>
<#assign keyPropertyName="${field.propertyName}"/>
</#if>
<#if field.comment!?length gt 0>
    /**
     * ${field.comment}
     */
</#if>
<#if "id" == field.name>
<#-- 主键 -->
    @TableId(value = "${field.name}", <#if field.keyIdentityFlag>type = IdType.AUTO<#else>type = IdType.${idType}</#if>)
    private ${field.propertyType} ${field.propertyName};
<#elseif "version" == field.name>
<#-- 乐观锁 -->
    @Version
    @TableField(value = "${field.name}", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.DEFAULT)
    private ${field.propertyType} ${field.propertyName};
<#elseif "deleted" == field.name>
<#-- 逻辑删除 -->
    @TableLogic(value = "0", delval = "1")
    @TableField(value = "${field.name}", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, select = false)
    private boolean ${field.propertyName};
<#elseif "creater" == field.name>
<#-- 创建人 -->
    @TableField(value = "${field.name}", insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.NEVER)
    private ${field.propertyType} ${field.propertyName};
<#elseif "create_time" == field.name>
<#-- 创建时间 -->
    @TableField(value = "${field.name}", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    private ${field.propertyType} ${field.propertyName};
<#elseif "modifier" == field.name>
<#-- 修改人 -->
    @TableField(value = "${field.name}", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.IGNORED)
    private ${field.propertyType} ${field.propertyName};
<#elseif "modify_time" == field.name>
<#-- 修改时间 -->
    @TableField(value = "${field.name}", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    private ${field.propertyType} ${field.propertyName};
<#else>
<#-- 普通字段 -->
    @TableField(value = "${field.name}", insertStrategy = FieldStrategy.NOT_NULL, updateStrategy = FieldStrategy.NOT_NULL)
    private ${field.propertyType} ${field.propertyName};
</#if>

</#list>
<#------------  END 字段循环遍历  ---------->
}
